#include <scdl/parser/Symbol.hpp>

#include <cstdlib>
#include <cstring>
#include <iostream>

using std::cout;
using namespace scdl;

Number::Number()
        : type('n'), val(0.0f), interval(1)
{
}

Number::~Number()
{
}

SymbolCategory Number::getCategory()
{
        switch(type) {
        case 'n':
                return CATEGORY_NUMBER;
        case 'c':
                return CATEGORY_COUNTER;
        case 'r':
                return CATEGORY_RANDOM_NUMBER;
        }

        return CATEGORY_TBD;
}

void Number::prettyPrint(bool verbose)
{
        switch(type) {
        case 'n':
                cout << val;
                break;
        case 'c':
                cout << val << ".." << step << ".." << end;
                break;
        case 'r':
                cout << val << ":" << end;
                break;
        }
}

void Number::setValue(float newval)
{
        end = val = newval;
        step = 0.0f;
        type = 'n';
        timeout = 1;
}

float Number::getValue()
{
        return val;
}
